*** 180412 Basic csv to dta 

** basic
insheet delimeted basic_2016.csv, delimiter("*") clear
gen nam_assg_temp = nam_assg + "*"+ v5 if v5 !=""
replace nam_assg_temp = nam_assg if v5 == ""
format nam_assg_temp %50s

drop nam_assg v5
ren nam_assg_temp nam_assg

* keep only utility patents 
gen d = substr(wku,1,1)
drop if d!="0"
drop d
destring(wku), replace

sa basic_1617, replace

** cite 
insheet delimited cite_2016.csv, delimiter("*") name clear

* keep only utility patents 
gen d = substr(citing,1,1)
drop if d!="0"
drop d
destring(citing), replace

* drop such as 2002/0184242
drop if length(cited)>7 
* keep only utility patents
gen d = substr(cited,1,1)
drop if inlist(d,"B","D","H","P","R","T")
drop d
destring(cited), replace

sa cite_1617.dta, replace





